home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK2.toast / Development Kits (Disc 2) / ScriptX / Code Samples / hotspots / butnshp.sx next >
Encoding:
Text File  |  1996-05-21  |  1.2 KB  |  46 lines  |  [TEXT/ttxt]

  1. in module DemoModule
  2.  
  3. --*******************************************************************************
  4. --*        Class name:    ButtonShape
  5. --*                                            
  6. --*     Inherits from: TwoDShape and Button                                    
  7. --*        Class type: Concrete
  8. --*         Component: User Interface
  9. --*
  10. --*       Description: This class is an example of how to mix in the Button class
  11. --*                    with a TwoDShape to produce a simple, yet fully functional
  12. --*                    'pushbutton'.
  13. --*
  14. --*             Usage: bs := new ButtonShape releasedBitmap:<some bitmap> \
  15. --*                                          pressedBitmap:<some bitmap> 
  16. --*                    
  17. --*               IVs:    none        
  18. --*
  19. --*           Methods:    setPressedAppearance
  20. --*                    setReleasedAppearance
  21. --*                    
  22. --*    Required files:    button.sx
  23. --*                    
  24. --*             Notes: 
  25. --*
  26. --*            Author:    Su Quek - Kaleida Labs, Inc.
  27. --*******************************************************************************
  28. class ButtonShape (TwoDShape, Button)
  29. end
  30.  
  31. -- The following methods are specialized to produce custom appearances.
  32. -- In this example, when the button is pressed, a red stroke appears around 
  33. -- the bitmap.
  34.  
  35. method setPressedAppearance self {class ButtonShape} -> 
  36. (
  37.     nextmethod self
  38.     self.stroke := (new Brush color:redColor)
  39. )
  40.  
  41. method setReleasedAppearance self {class ButtonShape} ->
  42. (
  43.     nextmethod self
  44.     self.stroke := undefined
  45. )
  46.